package cn.edu.zafu.bigdata.x.yaojy;
public class Cube {
    private double length;
    private double width;
    private double height;

    public Cube(double length, double width, double height){
        this.height = height;
        this.length = length;
        this.width = width;
    }

    public double getLength(){
        return length;
    }

    public double getWidth(){
        return width;
    }

    public double getHeight(){
        return height;
    }

    public boolean equals(Object obj){
        // 检查是否是同一对象
        if (this == obj) {
            return true;
        }
        // 检查是否为空或类型不同
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }

        Cube cube = (Cube) obj;

        return Double.compare(cube.height,height)==0 &&
                Double.compare(cube.length,length)==0 &&
                Double.compare(cube.width,width)==0;

    }

    public int hashCode() {
        return java.util.Objects.hash(length, width, height);
    }
}
